Resolve: #14 FEAT: Add fallback rendering for WebGL target #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tested on WebGL and Windows build. Both are working properly.
https://imgur.com/a/ATjwzvZ
https://drive.google.com/file/d/1ufoGV9TQzfnOK93pPi4ujVC8HG5ceZi8/view?usp=sharing (Seems imgur can't handle this video well)
I made a workaround for the WebGL build. The custom shader can't render properly so I decided to use normal
GameObjects for displaying.I added the
PoolFallbackclass to hook into thePoolclass to makeGameObjects for the projectiles when needed. Then update the appearance inProjectileManager.UpdateBuffers. I used a normalSpriteRendererfor rendering and thespriteis got from theTextureofProjectilePrefab. To load the default sprite when the texture is empty, I moved the sprites to Resources folder. Also, I added a flag calledFallbackRenderingintoProjectileManagerfor enabling this fallback rendering.I made sure outline prefabs will work properly as possible by setting a ceiled
sortingOrderaccording toZIndez. However, the data type isn't the same so there will be cases that don't work. If theZIndezof two objects is0.1and0.2, thesortingOrderfor both of them will be ceiled to1, causing the wrong order.